//
//  SearchResultModel.m
//  ProjectsOne
//
//  Created by iOS开发 on 2018/7/11.
//  Copyright © 2018年 iOS开发. All rights reserved.
//

#import "SearchResultModel.h"
#import "NSString+Custom.h"

@implementation SearchResultModel

- (NSString *)title {
    if (!_title) {
        NSString *str = @"这是标题";
        for (NSInteger i = 0; i < (arc4random() % 5); i++) {
            str = [str stringByAppendingString:@"这是标题"];
        }
        _title = str;
    }
    return _title;
}

- (NSString *)content {
    if (!_content) {
        NSString *str = @"这里是正文";
        for (NSInteger i = 0; i < (arc4random() % 30); i++) {
            str = [str stringByAppendingString:@"这里是正文"];
        }
        _content = str;
    }
    return _content;
}

- (NSAttributedString *)attrContent {
    if (!_attrContent) {
        _attrContent = [self.content stringWithParagraphlineSpeace:6 textColor:[UIColor colorWithHexString:@"808080"] textFont:[UIFont systemFontOfSize:14]];
    }
    return _attrContent;
}

@end

@implementation SearchResultClassModel

- (NSMutableArray<SearchResultModel *> *)resultArr {
    if (!_resultArr) {
        _resultArr = [NSMutableArray array];
        for (NSInteger i = 0; i < (arc4random() % 10); i++) {
            [_resultArr addObject:[[SearchResultModel alloc] init]];
        }
    }
    return _resultArr;
}

- (BOOL)isMore {
    return self.resultArr.count > 3;
}

@end
